#ifndef CSTANDARDSERIALDCBTRANSPORT_H_
#define CSTANDARDSERIALDCBTRANSPORT_H_

#include "ICommonDCBTransport.h"

namespace zl
{
namespace zlbase
{

/// \brief 标准串口通信协议
/// 
/// 用于A7人脸识别柜，RK3288寄存柜等
class CStandardSerialDCBTransport : public ICommonDCBTransport
{
public:
	CStandardSerialDCBTransport() = default;
	~CStandardSerialDCBTransport() = default;

	inline std::string Version() override { return "v1.0.0"; }

	inline int32_t OpenLocker(int32_t col, int32_t index) override
	{
		return cmd_openlocker(col, index);
	}

	inline int32_t GetDoorStatus(int32_t col, unsigned char* status, size_t& len) override
	{
		return cmd_getdoorstatus(col, status, len);
	}

	inline int32_t GetItemStatus(int32_t col, unsigned char* status, size_t& len) override
	{
		return cmd_getitemstatus(col, status, len);
	}

	inline int32_t GetFirmwareVersion(int32_t col, unsigned char* version, size_t& len) override
	{
		return cmd_getfirmwareversion(col, version, len);
	}

protected:
	int32_t cmd_openlocker(int32_t col, int32_t index);
	int32_t cmd_getdoorstatus(int32_t col, unsigned char* status, size_t& len);
	int32_t cmd_getitemstatus(int32_t col, unsigned char* status, size_t& len);
	int32_t cmd_getfirmwareversion(int32_t col, unsigned char* version, size_t& len);
};

} // namespace zlbase
} // namespace zl

#endif // CSTANDARDSERIALDCBTRANSPORT_H_